import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * Created by card on 2016/11/17.
 */
public class MaxTemperatureMapper extends Mapper<LongWritable, Text, Text, IntWritable>{

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        String array[] = line.split("\t");
        String year = array[0];
        int airTemperature = Integer.parseInt(array[1]);
        context.write(new Text(year), new IntWritable(airTemperature));
    }
}
